package com.doit.day03

import org.apache.spark.{SparkConf, SparkContext}

/**
 * @Author:
 * @WX: 17710299606
 * @Tips: 学大数据 ,到多易教育
 * @DOC: https://blog.csdn.net/qq_37933018?spm=1000.2115.3001.5343
 * @Description:
 */
object Demo03NumberP02 {
  def main(args: Array[String]): Unit = {

    val conf = new SparkConf()
      .setMaster("local[*]")
      .setAppName(this.getClass.getSimpleName)
    val sc = SparkContext.getOrCreate(conf)

    val rdd = sc.parallelize(List(1, 2, 3, 4, 5, 6, 7, 8), 3)
    rdd.filter(_ % 2 == 1).coalesce(2, false)
    println(rdd.distinct(2).getNumPartitions)
    rdd.groupBy(_%2==0 , 2)



  }

}
